Repository navigation
feat: render the agent pages from the docs view in every port - #674
Merged
Merged
Conversation
…Node The Rust port builds the port-neutral docs view from its loaded model (metaobjects::docs_view), byte-identical to TypeScript on every fixtures/explorer-conformance case, and a new opt-in docs-site generator writes explorer.json, the explorer app, explorer-model.js and explorer-stamp.js. The app is a canonical copy in metaobjects-codegen (synced by scripts/sync-explorer-app.sh, held by the explorer app copies gate) and ships in the published crate. Rust codegen now records generatedBy/sourceNode provenance in the hash manifest per the shared provenance vector, and the engine runs a run-output reader (docs-site) after every other generator, so gen and verify list the same files. The docs-site builder is engine, as the shared registry rules: eject refuses it and gen --list marks it [package-only]; an owned theme in codegen/docs-site/ replaces the shipped one. metaobjects::meta_endpoint adds the framework-free /_meta and /_meta/docs bodies (ETag and If-None-Match as TypeScript's).
# Conflicts: # docs/features/docs-view.md # docs/features/explorer-data.md # docs/features/explorer-site.md # docs/features/metadata-api.md # fixtures/generator-registry-conformance/registry.json
…ORMANCE explorer row and paragraph; --transport question left open
…ce), always-on pointer
…ages honour the ledger, C# drops its scope-only filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
requirements.toon,agent/requirements.mdand the model-onlyagent/schema.mdfrom the docs view alone. Each port renders the shared Mustache templates undertemplates/requirements/andtemplates/agent/.scripts/sync-doc-templates.shsyncs those templates into each port, andci-localgates the sync. Each port runs a docs-page conformance test againstfixtures/docs-page-conformance. A TypeScript project with no dialect now gets the model-onlyagent/schema.md. Every port's schema page leaves out a dependency's objects thatscope.includedoes not name. Rust has no requirement ledger yet, so its pages list every requirement in the view;docs/ports/rust.mdsays so. Java and Kotlin now filter rows through the shared ledger filter, and C#'s extra scope-only filter on the schema page is removed.storagesection. Every builder adds{physical, dialect, tables, views}, with table and column names from each port's naming helpers. The physical facts arenullorfalseunless a TypeScript run with a dialect fills them.fixtures/explorer-conformancepins the section. Becauseexplorer.jsonnow carries it, the explorer stamp pins in each port were re-pinned. The humanrequirements.mdis retired in every port: the explorer shows the ledger, and theledger-*fixtures were renamed to match.meta initandmeta agent-docs(which the C# and Java commands hand off to) add a "Pages generated for this project" section to.metaobjects/AGENTS.md. Python'smetaobjects agent-docsdoes the same. The list comes from the committed.metaobjects/.gen-state/.hashes/and names only the pages the lastgenwrote. With no pages wired, the file is byte-identical to before. A newfixtures/agent-pages-pointercorpus has 3 cases, which takes the shared corpus count from 48 to 49 inCONFORMANCE.md,AGENTS.mdand the site payload. Docs, the changelog entry and a false reference claim in the api-docs header are fixed. The pages are built without"\n"literals so they pass the layout ratchets.Validation
Risk Assessment
✅ Low: This round only changes the subDir default and its path prefix in three generators that are new in this PR, plus a stack-neutral pointer text. Default output paths and the conformance-pinned bytes are unchanged, the shipped bundles and manifests are consistent, and earlier rounds already reviewed the rest of the change.
Testing
I re-ran the configured affected selection after the fix round. The Java, Python, C#, TypeScript and packs lanes pass; the C# DependencyCodegenTests that failed in round 1 now pass. The Rust lane failed
cargo fmt --checkon the new test in the fix commit. I applied rustfmt's exact diff by hand, and the full Rust lane then passed. A cargo publish dry-run error caused by a stale target/package was an environment problem; clearing it fixed it. I drove three scenarios live against disposable projects in $DEV_SCRATCH, which I then deleted. (1) TSmeta genwith agentDocsFile on a dependency consumer wrote agent/schema.md. The page lists the local orders table (app::Order) and no Customer, Address or acme::common. (2) Pythonmetaobjects genon the same consumer wrote the model-only agent/schema.md, agent/requirements.md and requirements.toon, with no imported node and no retired requirements.md. (3) TS and Pythonagent-docsinsert the "Pages generated for this project" pointer above "## Rules", listing exactly the wired pages from .hashes. Without hashes, no section appears, and the file is byte-identical to the wired file minus that section. No UI surface: the evidence is generated Markdown and AGENTS.md files.meta genwith agentDocsFile on a disposable project that imports the acme-common dependency writes agent/schema.md listing only the local app::Order table, never Customer/Addressmetaobjects gen[agent-docs, requirements] on the same dependency consumer writes the model-only agent/schema.md, agent/requirements.md and requirements.toon, with no imported node and no re…meta agent-docs/metaobjects agent-docsadd the pages section only for pages recorded in .gen-state/.hashes; with no hashes AGENTS.md has no section and is otherwise identicalEvidence: TS agent/schema.md for a dependency consumer (no imported node)
Evidence: TS AGENTS.md with pointer (wired)
Evidence: TS AGENTS.md without pointer (no hashes)
Evidence: Python AGENTS.md with pointer (wired)
Evidence: Python pointer section
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
server/java/codegen-base/src/main/java/com/metaobjects/generator/AgentDocsGenerator.java:49- The ejectedagent-docscopy does not compile.AgentDocsGenerator.generatecallsRequirementsGenerator.inLedger(loader), which is a package-private static method on another class, with no import. It is registered with noejectWith(codegen-spring GeneratorRegistry.java:506), somvn metaobjects:eject -Dnames=agent-docscopies onlyAgentDocsGenerator.javaand renames its package (EjectSupport.ownedSource). In the owned packageRequirementsGeneratordoes not exist, and javac fails with "cannot find symbol". The file's own header advertises that eject command. No test catches this:EjectedGeneratorsCompileTestcompiles only the classes incom.metaobjects.generator.spring, not codegen-base'scom.metaobjects.generator. Fix: move the predicate into the packaged engine as a public helper (for exampleDocsPagesEmitter.inLedger(MetaDataLoader)incom.metaobjects.docs.pages, which an owned copy imports), or inline the two lines in each generator. Call that helper from both RequirementsGenerator.java:42 and AgentDocsGenerator.java:49.server/java/codegen-kotlin/src/main/kotlin/com/metaobjects/generator/kotlin/KotlinAgentDocsGenerator.kt:33- The intent says: "Rust has no requirement ledger of its own ... The other ports filter rows by the import ledger (requirements.inherit); Java was fixed to do so too." The Kotlin generators do not filter.DocsPagesEmitter.agentPages(view, choseMigrateDialect(loader), subDir, templateDir, null)passesnullfor the ledger predicate, and so does KotlinRequirementsGenerator.kt:30 (DocsPagesEmitter.requirementsPages(view, subDir, templateDir, null)). In a Kotlin project that imports a dependency published with requirements but not named inrequirements.inherit,requirements.toonandagent/requirements.mdtherefore list the dependency's requirements. Java's generators drop them for the same model. Nothing tests this: no Kotlin test runs these two generators against the corpus or against a dependency. The likely fix is to pass the same predicate Java builds (loader.root.dependencySet.takeIf { !it.isEmpty }?.let { it::inLedger }). Confirm that Kotlin is meant to filter as the intent states.server/typescript/packages/codegen-ts/src/docs-view-run.ts:62-runDocsViewnow callsctx.docs?.agentSchema?.()for every docs-view consumer:docsSiteFile()and the view-scoped template generator. That breaks two documented contracts.onceAgentSchema(docs-run.ts) says "a run that lists noagentDocsFile()never builds a schema, and never prints the reasons one could not be built".RunGenOpts.agentSchema(runner.ts:165) says "Absent:agentDocsFile()writes no schema page". A docs-site-only project with a dialect now builds the expected schema and can print its refusal reasons, and agentDocsFile now writes the model-only page when the schema is absent. Update both comments. They are outside the changed-file list, so this pass did not edit them.docs/ports/kotlin.md:167- Changed "The 20 generators registered incodegen-kotlin" to 22, and "The 20 generators above" (line 324) to 22. The table and GeneratorRegistry.kt now hold 22 entries after adding requirements and agent-docs.docs/ports/rust.md:85- The doc saidrequirementstakessubDir. The Rust RequirementsGenerator has noconfigureoverride, so the defaultconfigurerefuses any option with ERR_UNKNOWN_GENERATOR_OPTION. Reworded to "metamodel-docsandagent-docstakesubDir".server/typescript/packages/sdk/src/agent-context/assemble.ts:131- The newALWAYS_ON_PATHconstant had been inserted betweenassemble()'s JSDoc block and the function, so that doc attached to the constant. Moved the constant above the JSDoc. No behavior change.🔧 Fix applied.
4 infos still open:
server/typescript/packages/codegen-ts/src/docs-view-run.ts:62-runDocsViewnow callsctx.docs?.agentSchema?.()for every docs-view consumer:docsSiteFile()and the view-scoped template generator. That breaks two documented contracts.onceAgentSchema(docs-run.ts) says "a run that lists noagentDocsFile()never builds a schema, and never prints the reasons one could not be built".RunGenOpts.agentSchema(runner.ts:165) says "Absent:agentDocsFile()writes no schema page". A docs-site-only project with a dialect now builds the expected schema and can print its refusal reasons, and agentDocsFile now writes the model-only page when the schema is absent. Update both comments. They are outside the changed-file list, so this pass did not edit them.docs/ports/kotlin.md:167- Changed "The 20 generators registered incodegen-kotlin" to 22, and "The 20 generators above" (line 324) to 22. The table and GeneratorRegistry.kt now hold 22 entries after adding requirements and agent-docs.docs/ports/rust.md:85- The doc saidrequirementstakessubDir. The Rust RequirementsGenerator has noconfigureoverride, so the defaultconfigurerefuses any option with ERR_UNKNOWN_GENERATOR_OPTION. Reworded to "metamodel-docsandagent-docstakesubDir".server/typescript/packages/sdk/src/agent-context/assemble.ts:131- The newALWAYS_ON_PATHconstant had been inserted betweenassemble()'s JSDoc block and the function, so that doc attached to the constant. Moved the constant above the JSDoc. No behavior change.🔧 Fix applied.
7 infos still open:
docs/ports/kotlin.md:167- Changed "The 20 generators registered incodegen-kotlin" to 22, and "The 20 generators above" (line 324) to 22. The table and GeneratorRegistry.kt now hold 22 entries after adding requirements and agent-docs.docs/ports/rust.md:85- The doc saidrequirementstakessubDir. The Rust RequirementsGenerator has noconfigureoverride, so the defaultconfigurerefuses any option with ERR_UNKNOWN_GENERATOR_OPTION. Reworded to "metamodel-docsandagent-docstakesubDir".server/typescript/packages/sdk/src/agent-context/assemble.ts:131- The newALWAYS_ON_PATHconstant had been inserted betweenassemble()'s JSDoc block and the function, so that doc attached to the constant. Moved the constant above the JSDoc. No behavior change.server/typescript/packages/codegen-ts/src/generators/agent-docs-file.ts:17- The header comment was stale after this change. It said the requirements page comes fromwalkRequirements+requirementRows; the page is now built from the docs view (requirementRowsFromView/nodeIndexFromView). It also said a project with no physical schema gets no schema page; that project now gets the model-only page. Updated the derivation list and the 'AN EMPTY PAGE IS NO FILE' line. Comment-only, no behavior change.server/typescript/packages/sdk/src/agent-context/agent-pages.ts:30-wiredAgentPagesfinds the agent pages only by path suffix (agent/schema.md,agent/requirements.md). In TypeScript (agentDocsFile({subDir})), Python (AgentDocsGenerator(sub_dir=...)) and Rust ({"subDir": ...}),subDirREPLACES theagentdirectory. Example:subDir: "llm"writesdocs/llm/schema.mdanddocs/llm/requirements.md. The pointer then matches neither file, and.metaobjects/AGENTS.mdsilently gets no section. No error occurs; the result matches the behavior before this change. Sibling: server/python/src/metaobjects/agent_context/agent_pages.py:33 (_page_index). The TypeScript.hashes/values carry nogeneratedBy(plain hash strings, as in thenonefixture), so a fix cannot simply key on the generator name. A decision is needed: accept the limitation and document it, or record which generator wrote each path. That remedy, not the defect, needs authorization.agent-context/templates/agent-pages.md.mustache:3- The section always says "meta genwrites these from the metadata". Python writes the same template frommetaobjects agent-docs(agent_docs.py:133), and the C#/Java stacks reach it through the Node CLI. In those projects the pages come frommetaobjects gen,dotnet meta genormvn metaobjects:generate, notmeta gen. An agent may run the Node CLI that has no codegen for that port. The text is pinned by fixtures/agent-pages-pointer/*/expected-section.md. Options: make the wording stack-neutral (for example "genwrites these"), or render the command per stack. Changing it changes a pinned corpus, so confirm the wording.server/java/codegen-base/src/main/java/com/metaobjects/generator/AgentDocsGenerator.java:45- The new JVM and C#agent-docsgenerators treatsubDiras a PREFIX above a fixedagent/directory (default "":<subDir>/agent/schema.md; DocsPagesEmitter.agentPages, C# AgentDocsGenerator.cs:40). TypeScript (agent-docs-file.ts:79, default "agent"), Python (agent_docs_generator.py:46) and Rust (agent_docs.rs:63) treat it as the REPLACEMENT foragent/. A port's ownmetamodel-docsanddocs-sitealso use replacement semantics. Example:subDir: "docs/agent"writesdocs/agent/schema.mdin TS/Python/Rust anddocs/agent/agent/schema.mdin Java/Kotlin/C#. The port docs record each meaning, so this is a documented difference, not a hidden defect. Confirm the divergence is intended. Aligning it changes the new generators' option contract (KotlinAgentDocsGenerator.kt:31, C# AgentDocsGenerator.cs:40, docs/ports/java.md:473, docs/ports/kotlin.md:191, docs/ports/csharp.md).🔧 Fix applied.
4 infos still open:
docs/ports/kotlin.md:167- Changed "The 20 generators registered incodegen-kotlin" to 22, and "The 20 generators above" (line 324) to 22. The table and GeneratorRegistry.kt now hold 22 entries after adding requirements and agent-docs.docs/ports/rust.md:85- The doc saidrequirementstakessubDir. The Rust RequirementsGenerator has noconfigureoverride, so the defaultconfigurerefuses any option with ERR_UNKNOWN_GENERATOR_OPTION. Reworded to "metamodel-docsandagent-docstakesubDir".server/typescript/packages/sdk/src/agent-context/assemble.ts:131- The newALWAYS_ON_PATHconstant had been inserted betweenassemble()'s JSDoc block and the function, so that doc attached to the constant. Moved the constant above the JSDoc. No behavior change.server/typescript/packages/codegen-ts/src/generators/agent-docs-file.ts:17- The header comment was stale after this change. It said the requirements page comes fromwalkRequirements+requirementRows; the page is now built from the docs view (requirementRowsFromView/nodeIndexFromView). It also said a project with no physical schema gets no schema page; that project now gets the model-only page. Updated the derivation list and the 'AN EMPTY PAGE IS NO FILE' line. Comment-only, no behavior change.server/csharp/MetaObjects.Codegen/Generators/AgentDocsGenerator.cs:49- C# agent-docs builds the schema page from the whole docs view and passes the import-ledger predicate only to the requirements side. Imported tables (for example Customer, Address) appear in agent/schema.md. DependencyCodegenTests fails 4 tests: An_imported_node_emits_nothing_from_any_registered_generator ('agent/schema.md mentions an imported node'), plus An_imported_value_object_a_local_prompt_names_is_still_emitted, An_imported_value_object_a_local_entity_holds_is_still_emitted and An_imported_value_object_a_local_value_object_holds_is_still_emitted. Intended contract: an imported node emits nothing from any generator. Fix options: apply the ledger predicate to schema rows too (in DocsViewPages.Render, for every port), which changes the intended parity design and needs a human decision.scripts/ci-local.sh --affected --strict-toolchainsMO_CI_LIST_ONLY=1 scripts/ci-local.sh --affected --strict-toolchains (lane selection listed: ts-fast ts-unit java-slow python csharp rust packs)scripts/ci-local.sh --affected --strict-toolchains, run in background. Stopped by process group after the C# failure was confirmed; the run did not finish.C# conformance lane (in-process xUnit, not live): MetaObjects.Conformance.Tests passed 2945/2945; MetaObjects.Render.Tests passed 372/372; MetaObjects.Codegen.Tests: 4 DependencyCodegenTests failed.Not run: full regression suite (the run did not finish, so the full bun test, Java reactor, and full Python run are unknown).🔧 Fix applied.
2 errors still open:
server/rust/metaobjects-codegen/tests/reference_nodes.rs:106- The fix commit's new assert in reference_nodes.rs failedcargo fmt --all --check, so the Rust lane of the configured test command was red. I applied rustfmt's exact 4-line wrapping diff by hand (left in the worktree, not committed). With it,scripts/ci-local.sh --only rust --strict-toolchainspasses.meta genwith agentDocsFile on a disposable project that imports the acme-common dependency writes agent/schema.md listing only the local app::Order table, never Customer/Addressmetaobjects gen[agent-docs, requirements] on the same dependency consumer writes the model-only agent/schema.md, agent/requirements.md and requirements.toon, with no imported node and no re…meta agent-docs/metaobjects agent-docsadd the pages section only for pages recorded in .gen-state/.hashes; with no hashes AGENTS.md has no section and is otherwise identicalscripts/ci-local.sh --affected --strict-toolchainsscripts/ci-local.sh --affected --strict-toolchains: java-reactor, python, csharp, typescript conformance, ts build+typecheck, ts unit, completeness-gate and packs green; rust red on cargo fmtFixed the rustfmt diff in server/rust/metaobjects-codegen/tests/reference_nodes.rs;cargo fmt --all --checkpassesscripts/ci-local.sh --only rust --strict-toolchains: tests pass; the publish dry-run hits a cargo internal error from a stale target/package; afterrm -rf server/rust/target/packagethe re-run passes (LOCAL CI PASSED)Live:node server/typescript/packages/cli/dist/bin/meta.js genwith agentDocsFile on a disposable consumer of the acme-common dependency, sqlite dialectLive:server/python/.venv/bin/metaobjects genwith [agent-docs, requirements] on the same consumer plus a local requirement.functionalLive:meta agent-docs --server typescripton a wired project and on a project with no hashes;metaobjects agent-docs --server pythonon a wired project✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
Pipeline run and notes
.metaobjects/AGENTS.mdpointer recognises only the defaultagent/page paths. With a customsubDir, no section is written; that is the behaviour from before this PR, and it never writes a wrong pointer. Recording which generator wrote each path would change the committed.hashes/format.agent/schema.mdleaves imported (dependency) nodes out in every port;docs-sitestays the one whole-model exception.subDironagent-docsreplacesagent/in every port.